﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WinSat
{
    public partial class frmAyarlar : Form
    {
        public frmAyarlar()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Program.Session[Settings.Sunucu] = txtSunucu.Text;
            Program.Session[Settings.Veritabani] = txtVt.Text;
            Program.Session[Settings.VtKullaniciAdi] = txtKullanici.Text;
            Program.Session[Settings.VtSifre] = txtParola.Text;
            Program.Session[Settings.Tedarikci] = txtTedarikci.Text;
            Program.Session[Settings.EvrakSeri] = txtSeri.Text;

            if (comboBox1.SelectedIndex == 0)
            {
                Program.Session[Settings.BaglantiTipi] = "sql";
            }
            else if (comboBox1.SelectedIndex == 1)
            {
                Program.Session[Settings.BaglantiTipi] = "servis";
            }
            else
            {
                Program.Session[Settings.BaglantiTipi] = "local";
            }
            this.Close();
        }

        private void txtSunucu_GotFocus(object sender, EventArgs e)
        {
            Sip.Show();
        }

        private void txtSunucu_LostFocus(object sender, EventArgs e)
        {
            Sip.Hide();
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == 1)
            {
                label1.Text = "Servis Url";
                txtSunucu.Text = "http://0/fuar/service.asmx";
                txtVt.Enabled = false;
                txtKullanici.Enabled = false;
                txtParola.Enabled = false;
            }
            else
            {
                label1.Text = "Sunucu Adı:";
                txtSunucu.Text = "";
                txtVt.Enabled = true;
                txtKullanici.Enabled = true;
                txtParola.Enabled = true;
            }
        }
    }
}